<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Dept extends Model
{

    /** 表名 */
    protected $table = 'dept';

    /** 主键 id */
    protected $primaryKey = 'id';

    public $timestamps = false;

    protected $fillable = [
        'id',
        'parentId',
        'name',
        'principal',
        'phone',
        'email',
        'sort',
        'status',
        'remark',
        'createTime'
    ];

    // 定义与 User 模型的关联（一对多）
    public function users(): HasMany
    {
        return $this->hasMany(User::class, 'deptId');
    }
}
